<template>
  <div class="reportFormPage">
    <div class="report-dom">
      <el-row>
        <el-col :span="5" :offset="19">
          <div class="pageNumBox">
            <span>第</span>
            <span class="placeholder-min text-center">&nbsp;{{ form.page }}&nbsp;</span>
            <span>页，共</span>
            <span class="placeholder-min text-center">&nbsp;{{ form.totalPage }}&nbsp;</span>
            <span>页</span>
          </div>
        </el-col>
      </el-row>
      <div class="topTwoBox">
        <div class="centerName">普通混凝土配合比设计试验检测报告</div>
        <div class="codeText">
          <tr>
            BGLQ05002F
          </tr>
        </div>
      </div>
      <div class="threeTopBox">
        <div class="left-border">
          <div class="box-title">检测单位名称：</div>
          <div class>{{ form.jiancdwmc }}</div>
        </div>
        <div class="right-border">
          <span>报告编号：</span>
          <span class="placeholder">{{ form.baogbh }}</span>
        </div>
      </div>
      <!-- .........................1111111111111111111111111111111......................................................... -->
      <div class="table-border">
        <table height="220px" class="top-table">
          <tbody>
            <tr>
              <td height="25" align="center" width="15%">
                <span style="width: 90px; display: inline-block">施工/委托单位</span>
              </td>
              <td width="35%" class="text-center">
                <span>{{ form.shigwtdw }}</span>
              </td>
              <td align="center" width="15%">
                <span style="width: 90px; display: inline-block">工程名称</span>
              </td>
              <td width="35%" class="text-center">
                <span>{{ form.gongcmc }}</span>
              </td>
            </tr>
            <tr>
              <td height="25" align="center">工程部位/用途</td>
              <td class="text-center" colspan="3">
                <span>{{ form.gongcbwyt }}</span>
              </td>
            </tr>
            <tr>
              <td height="50" align="center">样品信息</td>
              <td class="specimen-border" colspan="3">
                <span>样品名称：</span>
                <span :class="{ placeholder: !form.yangpmc }">{{ form.yangpmc }}</span>
                <span>；样品编号：</span>
                <span :class="{ 'placeholder-long': !form.yangpbh }">{{ form.yangpbh }}</span>
                <span>；样品数量：</span>
                <span :class="{ placeholder: !form.yangpsl }">{{ form.yangpsl }}</span>
                <span>；样品状态：</span>
                <span :class="{ placeholder: !form.yangpzt }">{{ form.yangpzt }}</span>
<!--                <span>；来样时间：</span>-->
<!--                <span :class="{ placeholder: !form.yangpsj }">{{ form.yangpsj }}</span>-->
              </td>
            </tr>
            <tr>
              <td height="50" align="center" width="15%">
                <span style="width: 90px; display: inline-block">检测依据</span>
              </td>
              <td width="35%">
                <span v-if="isPdf">{{ form.jiancyj }}</span>
                <el-input v-else type="textarea" v-model="form.jiancyj" :rows="2" class="mark" @dblclick.native="showBsJiancyjView" readonly />
              </td>
              <td align="center" width="15%">
                <span style="width: 90px; display: inline-block">判定依据</span>
              </td>
              <td width="35%">
                <span v-if="isPdf">{{ form.pandyj }}</span>
                <el-input v-else type="textarea" v-model="form.pandyj" :rows="2" @dblclick.native="showBsJudgeBaseView" @focus="handleFocus('pandyj')" class="mark" />
              </td>
            </tr>
            <tr class="bottom-border">
              <td height="50" align="center">
                <div>主要仪器设备</div>
                <div>名称及编号</div>
              </td>
              <td colspan="3">
                <span v-if="isPdf">{{ form.zhuyyqsbmcjbh }}</span>
                <el-input v-else type="textarea" :rows="2" v-model="form.zhuyyqsbmcjbh" class="height100 width100 mark" @dblclick.native="showBsInstrumentView" readonly></el-input>
              </td>
            </tr>
          </tbody>
        </table>
        <!-- .................................22222222222222222222222222222222............................................... -->
        <table height="550px" class="middle-table">
          <tbody>
            <!--          2223212-->
            <tr trindex="1" width="100%" height="20">
              <td colspan="2" width="15%">样品名称</td>
              <td colspan="2" width="13%">样品编号</td>
              <td colspan="2" width="15%">样品规格/牌号</td>
              <td colspan="3" width="21%">生产厂家/产地</td>
              <td colspan="2" width="14%">进场日期</td>
              <td colspan="1" width="8%">样品数量</td>
              <td colspan="2" width="15%">密度(kg/m³)</td>
            </tr>
            <tr trindex="2" v-for="(item, index) of form.detailList" :key="index" height="20">
              <td colspan="2">
                <el-input v-model="item.yangpmc" @keydown.native="handleKeyDown($event, index, 0)" :ref="`${index}_0`" />
              </td>
              <td colspan="2">
                <el-input v-model="item.yangpbh" @keydown.native="handleKeyDown($event, index, 1)" :ref="`${index}_1`" />
              </td>
              <td colspan="2">
                <el-input v-model="item.yangpggph" @keydown.native="handleKeyDown($event, index, 2)" :ref="`${index}_2`" />
              </td>
              <td colspan="3">
                <el-input v-model="item.shengccjcd" @keydown.native="handleKeyDown($event, index, 3)" :ref="`${index}_3`" />
              </td>
              <td colspan="2">
                <el-date-picker v-model="item.jincrq" class="syrqStyle hide-icon width100" value-format="yyyy-MM-dd" format="yyyy-MM-dd" />
              </td>
              <td colspan="1">
                <el-input v-model="item.yangpsl" @keydown.native="handleKeyDown($event, index, 4)" :ref="`${index}_4`" />
              </td>
              <td colspan="2">
                <el-input v-model="item.mid" @keydown.native="handleKeyDown($event, index, 5)" :ref="`${index}_5`" />
              </td>
            </tr>

            <!--233222-->
            <tr trindex="1" width="100%" height="20">
              <td colspan="2" width="15%">设计强度等级</td>
              <td colspan="3">{{ form.shejqddj }}</td>
              <td colspan="3" width="21%">设计坍落度</td>
              <td colspan="2">{{ form.shejtld }}</td>
              <td colspan="2" width="15%">试配强度(MPa)</td>
              <td colspan="2">{{ form.shipqd }}</td>
            </tr>

            <tr trindex="1" width="100%" height="20">
              <td colspan="2" width="15%">初凝时间</td>
              <td colspan="3">{{ form.chunsjpjz }}</td>
              <td colspan="3" width="21%">终凝时间</td>
              <td colspan="2">{{ form.zhongnsjpjz }}</td>
              <td colspan="2" width="15%">泌水率</td>
              <td colspan="2">{{ form.misl }}</td>
            </tr>

            <tr>
              <td colspan="1" width="8%" rowspan="5">试验室<br />配合比</td>
              <td colspan="1" width="5%" rowspan="2">试验编号</td>
              <td colspan="2" width="8%" rowspan="2">水胶比</td>
              <td colspan="1" rowspan="2">砂率(%)</td>
              <td colspan="9" rowspan="1">各种材料每方用量(kg)</td>
            </tr>
            <tr>
              <td>水泥</td>
              <td>细集料</td>
              <td>粗集料</td>
              <td>水</td>
              <td width="7%">{{ form.yonglmc1 }}</td>
              <td width="7%">{{ form.yonglmc2 }}</td>
              <td width="7%">{{ form.yonglmc3 }}</td>
              <td width="7%">{{ form.yonglmc4 }}</td>
              <td width="7%">{{ form.yonglmc5 }}</td>
            </tr>
            <tr>
              <td colspan="1">
                <el-select placeholder="请选择" clearable v-model="form.shiybh" @change="shiybhChange" class="hide-icon width100">
                  <el-option v-for="item in shiybhlist" :key="item.value" :label="item.label" :value="item.value"></el-option>
                </el-select>
              </td>
              <td colspan="2">{{ form.shuijb }}</td>
              <td colspan="1">{{ form.shal }}</td>
              <td>{{ form.shuin }}</td>
              <td>{{ form.xijl }}</td>
              <td>{{ form.cujl }}</td>
              <td>{{ form.shui }}</td>
              <td>{{ form.yongl1 }}</td>
              <td>{{ form.yongl2 }}</td>
              <td>{{ form.yongl3 }}</td>
              <td>{{ form.yongl4 }}</td>
              <td>{{ form.yongl5 }}</td>
            </tr>
            <tr>
              <td colspan="13" height="20">{{ form.peihbmc }}</td>
            </tr>
            <tr>
              <td colspan="13" height="20">{{ form.zhonglphb }}</td>
            </tr>

            <tr>
              <td colspan="3" height="20">实测容重(kg/m³)</td>
              <td colspan="4" height="20">{{ form.shicrz }}</td>
              <td colspan="3" height="20">实测坍落度(mm)</td>
              <td colspan="4" height="20">{{ form.shictld }}</td>
            </tr>
            <tr>
              <td colspan="4" height="20">制件日期</td>
              <td colspan="3" height="20">{{ form.chengxrq }}</td>
              <td colspan="7" rowspan="10" class="echarts-border">
                <table-line-log-more-chart
                  :className="'echarts-border'"
                  :chartData="chartData"
                  :xMin="chartData.xMin"
                  :xMax="chartData.xMax"
                  :yMin="chartData.yMin"
                  :yMax="chartData.yMax"
                  :interval="interval"
                  :yInterval="yInterval"
                  :isSmooth="true"
                />
              </td>
            </tr>
            <tr>
              <td colspan="4" height="20">试件尺寸</td>
              <td colspan="3" height="20">{{ form.shijcc }}</td>
            </tr>

            <tr>
              <td colspan="2" rowspan="4" height="20">7天强度</td>
              <td colspan="2" height="20">试验日期</td>
              <td colspan="3" height="20">{{ form.shiyrq7q }}</td>
            </tr>
            <tr>
              <td colspan="2">荷载(kN)</td>
              <td colspan="1">{{ form.qhzq1 }}</td>
              <td colspan="1">{{ form.qhzq2 }}</td>
              <td colspan="1">{{ form.qhzq3 }}</td>
            </tr>
            <tr>
              <td colspan="2">强度(MPa)</td>
              <td colspan="1">{{ form.qqdq1 }}</td>
              <td colspan="1">{{ form.qqdq2 }}</td>
              <td colspan="1">{{ form.qqdq3 }}</td>
            </tr>
            <tr>
              <td colspan="2">结果</td>
              <td colspan="3">{{ form.qpjqdq1 }}</td>
            </tr>

            <tr>
              <td colspan="2" rowspan="4" height="20">28天强度</td>
              <td colspan="2" height="20">试验日期</td>
              <td colspan="3" height="20">{{ form.shiyrq28q }}</td>
            </tr>
            <tr>
              <td colspan="2">荷载(kN)</td>
              <td colspan="1">{{ form.ehzq1 }}</td>
              <td colspan="1">{{ form.ehzq2 }}</td>
              <td colspan="1">{{ form.ehzq3 }}</td>
            </tr>
            <tr>
              <td colspan="2">强度(MPa)</td>
              <td colspan="1">{{ form.eqdq1 }}</td>
              <td colspan="1">{{ form.eqdq2 }}</td>
              <td colspan="1">{{ form.eqdq3 }}</td>
            </tr>
            <tr>
              <td colspan="2">结果</td>
              <td colspan="3">{{ form.epjqdq1 }}</td>
            </tr>
            <tr>
              <td rowspan="2">粗集料掺配</td>
              <td>种类</td>
              <td colspan="3">{{ form.cujlzl1 }}</td>
              <td colspan="3">{{ form.cujlzl2 }}</td>
              <td colspan="3">{{ form.cujlzl3 }}</td>
              <td colspan="3">{{ form.cujlzl4 }}</td>
            </tr>
            <tr>
              <td>比例</td>
              <td colspan="3">{{ form.cujlbl1 }}</td>
              <td colspan="3">{{ form.cujlbl2 }}</td>
              <td colspan="3">{{ form.cujlbl3 }}</td>
              <td colspan="3">{{ form.cujlbl4 }}</td>
            </tr>
          </tbody>
        </table>
        <!-- .....................................................33333333333333333................................................... -->
        <table height="100px" class="bottom-table">
          <tbody>
            <tr>
              <td style="border-bottom-width: 1px">
                <span v-if="isPdf" class="textarea-span">{{ form.jiancjl }}</span>
                <el-input v-else type="textarea" :rows="2" v-model="form.jiancjl" @focus="handleFocus('jiancjl')" @dblclick.native="getJcjl()" />
              </td>
            </tr>
            <tr>
              <td>
                <span v-if="isPdf" class="textarea-span">{{ form.fujsm }}</span>
                <el-input v-else type="textarea" :rows="2" v-model="form.fujsm" @focus="handleFocus('fujsm')" />
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <!-- .................................44444444444............................................. -->
      <table height="22px" class="transparent">
        <tbody>
          <tr>
            <td width="10%" align="right">检测：</td>
            <td width="15%" align="left"></td>
            <td width="10%" align="right">审核：</td>
            <td width="15%" align="left"></td>
            <td width="10%" align="right">批准：</td>
            <td align="left" width="15%"></td>
            <td width="10%">日期：</td>
            <td align="left" width="15%">
              <div style="display: inline-block; margin-left: 20px">年</div>
              <div style="display: inline-block; margin-left: 20px">月</div>
              <div style="display: inline-block ;margin-left: 20px">日</div>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <bs-jiancyj-view ref="bsJiancyjViewRef" @select="selectJiancyj" :syType="syType"></bs-jiancyj-view>
    <bs-instrument-view ref="bsInstrumentViewRef" @select="selectInstrument"></bs-instrument-view>
    <bs-judge-base-view ref="bsJudgeBaseViewRef" @select="selectJudge" :syType="syType" />
    <bs-judge-base-edit-view ref="bsJudgeBaseEditViewRef" @submit="selectJudgeBaseEdit" :syType="syType" />
  </div>
</template>

<script>
import { getSnhntPhbbgBsInfo, computeJiaosbqdBsInfo } from "@/api/reportsnhnt/snhntPhbbgBsInfo";
import BsInstrumentView from "@/views/dept/bsInstrument/BsInstrumentView.vue";
import BsJiancyjView from "@/views/sycs/bsJiancyj/BsJiancyjView.vue";
import Bus from "@/utils/bus";
import { emptyConvert, handleFocus, uniqueStr, handleKeyDown } from "@/views/reportForms/utils";
import TableLineLogMoreChart from "@/views/reportForms/components/TableLineLogMoreChart.vue";

import BsJudgeBaseView from "@/views/sycs/bsJudgeBase/BsJudgeBaseView";
import BsJudgeBaseEditView from "@/views/sycs/bsJudgeBase/BsJudgeBaseEditView";
import { computeBiQualification } from "@/api/sycs/biQualification";
import decimal from "@/utils/big-decimal";

export default {
  name: "snhntphbbg",
  components: {
    BsInstrumentView,
    BsJiancyjView,
    BsJudgeBaseView,
    TableLineLogMoreChart,
    BsJudgeBaseEditView
  },
  data() {
    return {
      value: 1,
      shiybhlist: [
        { label: "1", value: "1" },
        { label: "2", value: "2" },
        { label: "3", value: "3" }
      ],
      chartData: {
        xName: "胶水比",
        yName: "强度MPa",
        xData: [],
        yData: [],
        seriesData: [],
        time: "",
        xMin: 0,
        xMax: 9,
        yMin: 0,
        yMax: 20
      },
      interval: 0.1,
      yInterval: 1,
      form2: {
        shuijb: "",
        shal: "",
        shuin: "",
        xijl: "",
        cujl: "",
        shui: "",
        juqsxgxnjsj: "",
        shiysphb: "",
        shicrz: "",
        shictld: "",
        zhijrq: "",
        shijcc: "",
        shiyrq7: "",
        hez71: "",
        hez72: "",
        hez73: "",
        qiangd71: "",
        qiangd72: "",
        qiangd73: "",
        qiangdpj7: "",
        shiyrq28: "",
        hez281: "",
        hez282: "",
        hez283: "",
        qiangd281: "",
        qiangd282: "",
        qiangd283: "",
        qiangdpj28: ""
      },
      form3: {
        shuijb: "",
        shal: "",
        shuin: "",
        xijl: "",
        cujl: "",
        shui: "",
        juqsxgxnjsj: "",
        shiysphb: "",
        shicrz: "",
        shictld: "",
        zhijrq: "",
        shijcc: "",
        shiyrq7: "",
        hez71: "",
        hez72: "",
        hez73: "",
        qiangd71: "",
        qiangd72: "",
        qiangd73: "",
        qiangdpj7: "",
        shiyrq28: "",
        hez281: "",
        hez282: "",
        hez283: "",
        qiangd281: "",
        qiangd282: "",
        qiangd283: "",
        qiangdpj28: ""
      },
      form4: {
        shuijb: "",
        shal: "",
        shuin: "",
        xijl: "",
        cujl: "",
        shui: "",
        juqsxgxnjsj: "",
        shiysphb: "",
        shicrz: "",
        shictld: "",
        zhijrq: "",
        shijcc: "",
        shiyrq7: "",
        hez71: "",
        hez72: "",
        hez73: "",
        qiangd71: "",
        qiangd72: "",
        qiangd73: "",
        qiangdpj7: "",
        shiyrq28: "",
        hez281: "",
        hez282: "",
        hez283: "",
        qiangd281: "",
        qiangd282: "",
        qiangd283: "",
        qiangdpj28: ""
      },
      jilbh: "",
      form: {
        shuinssb: "",
        shejqddj: "",
        yanghhj: "",
        gongcbwyt: "",
        baogbh: "",
        shigwtdw: "济南绕城高速东线小许家枢纽至遥墙机场段改扩建工程房建工程综合楼",
        jiancdwmc: "山东路桥集团试验检测中心有限公司泰安高速公路施工总承包项目工地试验室",
        totalPage: "",
        page: "",
        zhuyyqsbmcjbh: "",
        jiancyj: "",
        gongcmc: "汾阳至石楼高速公路",
        yangpmc: "K39+820-K40+440原地面",
        yangpbh: "JTG/T 3610-2019",
        laiysj: "2022年03月09日",
        yangpsl: "3kg",
        yangpzt: "完好无损"
      },
      twoTableData: {},
      threeTableData: {},
      jiancjl: "检测结论：经检测，该水泥砂浆拌和物的分层度实值为15mm，其他所检参数符合JGJ/T98-2010的技术要求。",
      fjsm: "附加声明：",
      dateText: "2024年05月10日",
      readonly: false,
      arr: [
        "chengxrq",
        "chengymj",
        "cujl",
        "ehz1",
        "ehz2",
        "ehz3",
        "ehzq1",
        "ehzq2",
        "ehzq3",
        "epjqd1",
        "epjqdq1",
        "eqd1",
        "eqd2",
        "eqd3",
        "eqdq1",
        "eqdq2",
        "eqdq3",
        "juqsxgxnjsj",
        "qhz1",
        "qhz2",
        "qhz3",
        "qhzq1",
        "qhzq2",
        "qhzq3",
        "qqd1",
        "qqd2",
        "qqd3",
        "qqdq1",
        "qqdq2",
        "qqdq3",
        "shicrz",
        "shijcc",
        "shictld",
        "shiyrq7q",
        "shiyrq28q",
        "shui",
        "shuijb",
        "shal",
        "shuin",
        "xijl",
        "zhonglphb",
        "yongl1",
        "yongl2",
        "yongl3",
        "yongl4",
        "yongl5"
      ]
    };
  },
  props: {
    excelId: {
      type: [String, Number],
      default: () => ""
    },
    isPdf: {
      type: Boolean,
      default: () => false
    },
    syType: {
      type: [String, Number],
      default: () => ""
    }
  },
  watch: {},
  created() {
    this.getInfo();
  },
  mounted() {
    //接收form2 表单；
    Bus.$on("setSnhntphbData", (data) => {
      this.form.dataList = data;
      this.initData(data);
      this.calculateInfo();
    });

    //接收form表单值。
    Bus.$on("setSnhntphbform", (data) => {
      const arr = ["shipqd", "shejqddj", "shejtld", "yonglmc1", "yonglmc2", "yonglmc3", "yonglmc4", "yonglmc5", "peihbmc"];
      arr.forEach((item) => {
        this.form[item] = data[item];
      });
      this.$forceUpdate();
    });
    //接收凝结时间传值
    Bus.$on("setSnhntphbnjsj", (data) => {
      this.form.chunsjpjz = data.chunsjpjz;
      this.form.zhongnsjpjz = data.zhongnsjpjz;
    });
    //接收泌水率传值
    Bus.$on("setSnhntphbmisl", (data) => {
      this.form.misl = data.misl;
    });

    // 检测依据
    Bus.$on("setSnhntphbBgjcyj", (data) => {
      const { jiancyj, jiancyjIds } = data;
      const str = jiancyj + (this.form.jiancyj ? "、" + this.form.jiancyj : "");
      const ids = jiancyjIds + (this.form.jiancyjIds ? "," + this.form.jiancyjIds : "");
      this.form.jiancyj = uniqueStr(str, "、");
      this.form.jiancyjIds = uniqueStr(ids, ",");
    });
    // 主要设备
    Bus.$on("setSnhntphbBgZhuyyqsbmcjbh", (data) => {
      const { zhuyyqsbmcjbh, shebIds } = data;
      const str = zhuyyqsbmcjbh + (this.form.zhuyyqsbmcjbh ? "、" + this.form.zhuyyqsbmcjbh : "");
      const ids = shebIds + (this.form.shebIds ? "," + this.form.shebIds : "");
      this.form.zhuyyqsbmcjbh = uniqueStr(str, "、");
      this.form.shebIds = uniqueStr(ids, ",");
    });
  },
  beforeDestroy() {
    // 或者你可以使用其他合适的生命周期钩子
    // 停止监听事件
    Bus.$off("setSnhntphbform");
    Bus.$off("setphbbglist");
    Bus.$off("setSjBgJiancyj");
    Bus.$off("setSjBgZhuyyqsbmcjbh");
  },
  methods: {
    //处理试验数据。
    initData(data) {
      const arr = this.arr;
      data.forEach((item, index) => {
        arr.forEach((key) => {
          this["form" + (index + 2)][key] = item[key];
        });
      });
      this.$forceUpdate();
      this.shiybhChange();
    },
    //选择试验编号
    shiybhChange() {
      const e = this.form.shiybh;
      const arr = this.arr;
      arr.forEach((item) => {
        this.form[item] = this["form" + (Number(e) + 1)][item];
      });
    },
    getInfo() {
      // if (!this.excelId) {
      //   return;
      // }
      getSnhntPhbbgBsInfo(this.excelId || this.$defaultExcelId).then((response) => {
        this.form = response.data;
        if (!this.form.jiancjl) {
          this.form.jiancjl = "检测结论：";
        }
        if (!this.form.fujsm) {
          this.form.fujsm = "附加声明：";
        }
        if (this.form.dataList) {
          this.initData(this.form.dataList);
        }
        //试验室配合比名称
        this.form.peihbmc = "胶凝材料：水泥：细集料：粗集料：水";
        if (this.form.yonglmc1) {
          this.form.peihbmc += "：" + this.form.yonglmc1;
        }
        if (this.form.yonglmc2) {
          this.form.peihbmc += "：" + this.form.yonglmc2;
        }
        if (this.form.yonglmc3) {
          this.form.peihbmc += "：" + this.form.yonglmc3;
        }
        if (this.form.yonglmc4) {
          this.form.peihbmc += "：" + this.form.yonglmc4;
        }
        if (this.form.yonglmc5) {
          this.form.peihbmc += "：" + this.form.yonglmc5;
        }
        this.setEcharts();
      });
    },
    submitForm() {
      return this.form;
    },
    // 显示判定依据列表
    showBsJudgeBaseView() {
      this.$refs.bsJudgeBaseViewRef.init(this.form.pandyjIds);
    },
    // 判断依据选择
    selectJudge(info) {
      if (!info || !info.label) {
        return;
      }
      if (!this.form.pandyj) {
        this.form.pandyj = info.label;
      } else {
        if (info && info.label) {
          this.form.pandyj += "、" + info.label;
        }
      }
      // 添加指标 info.list
      let keys = [];
      info.list.forEach((item) => {
       if (this.form.baDetailVos[item.refQualId] && this.form.baDetailVos[item.refQualId].jiancjg) {
          this.form.baDetailVos[item.refQualId].symbolValue = item.symbolValue;
          this.form.baDetailVos[item.refQualId].num1 = item.num1;
          this.form.baDetailVos[item.refQualId].num2 = item.num2;
          keys.push(item.refQualId);
        }
      });
      this.computeDetectionResult(keys);
    },
    // 计算检测结果
    computeDetectionResult(keys) {
      if (!keys || keys.length <= 0) {
        return;
      }
      const data = keys.map((key) => {
        const info = {
          ...this.form.baDetailVos[key],
          jiancjg: this.form.baDetailVos[key].jiancjg == "-" ? "" : this.form.baDetailVos[key].jiancjg
        };
        return info;
      });
      computeBiQualification(data).then((res) => {
        const returnData = res.data;
        returnData.forEach((item) => {
          if (!item.symbolValue && !item.num1 && !item.num2) {
            item.jiszb = "-";
          }
          item.jiancjg = item.jiancjg ? item.jiancjg : "-";
          this.form.baDetailVos[item.qualId] = item;
        });
      });
    },
    // 获取检测结论
    getJcjl() {
      //       检测结论：经验证，选择水胶比0.39作为试验室配合比，该配合比(28d)实测强度为49.5MPa，达到试配强度的102.7%，
      // 符合JGJ 55-2011《普通混凝土配合比设计规程》及设计文件中技术要求。
      //计算强度百分比；
      let zhanb = "";
      if (this.form.epjqdq1 && this.form.shipqd) {
        zhanb = decimal.divide(parseFloat(this.form.epjqdq1) * 100, parseFloat(this.form.shipqd), 1);
      }
      this.form.jiancjl =
        "检测结论：经验证，选择水胶比" +
        this.form.shuijb +
        "作为试验室配合比，该配合比(28d)实测强度为" +
        this.form.epjqdq1 +
        "MPa,达到试配强度的" +
        zhanb +
        "%，符合JGJ 55-2011《普通混凝土配合比设计规程》及设计文件中技术要求。";
    },
    // 编辑单个技术指标后赋值
    selectJudgeBaseEdit(info) {
      if (info.qualId) {
        this.form.baDetailVos[info.qualId] = info;
      }
      this.computeDetectionResult([info.qualId]);
    },

    // 显示检测依据列表
    showBsJiancyjView() {
      this.$refs.bsJiancyjViewRef.init(this.form.jiancyjIds);
    },
    // 检测依据选择
    selectJiancyj(info) {
      // this.$set(this.form, 'jiancyj', info.label);
      this.form.jiancyj = info.label;
      this.form.jiancyjIds = info.ids;
    },
    // 仪器选择
    selectInstrument(info) {
      this.form.zhuyyqsbmcjbh = info.label;
      this.form.shebIds = info.ids;
    },
    // 显示仪器列表
    showBsInstrumentView() {
      this.$refs.bsInstrumentViewRef.init(this.form.shebIds);
    },
    // 计算图表
    calculateInfo() {
      let flg = false;
      for (let index = 0; index < this.form.dataList.length - 1; index++) {
        const item = this.form.dataList[index];
        if (!item.shuijb || !item.epjqdq1) {
          flg = true;
          break;
        }
      }
      if (flg) {
        this.chartData.seriesData = [];
        return;
      }
      computeJiaosbqdBsInfo(this.form).then((response) => {
        this.form = response.data;
        this.setEcharts();
      });
    },
    // 拼接图表数据
    setEcharts() {
      if (!this.form.chartData || this.form.chartData.length <= 0) {
        this.chartData.seriesData = [];
        return;
      }
      let data1 = [];
      let data2 = [];
      let data3 = [];
      let xMin = 0;
      let xMax = 0;
      let yMin = 0;
      let yMax = 0;
      this.form.chartData.forEach((item, index) => {
        if (index == 0) {
          xMin = item.point[0];
          xMax = item.point[0];
          yMin = item.point[1];
          yMax = item.point[1];
        }
        if (item.point[0] < xMin) {
          xMin = item.point[0];
        }
        if (item.point[1] < yMin) {
          yMin = item.point[1];
        }
        if (item.point[0] > xMax) {
          xMax = item.point[0];
        }
        if (item.point[1] > yMax) {
          yMax = item.point[1];
        }
        switch (item.flag) {
          case "100":
            data1.push(item.point);
            break;
          case "010":
            data2.push(item.point);
            break;
          case "011":
            data3.push(item.point);
            break;
        }
      });
      xMin = xMin > 0 ? decimal.subtract(xMin, this.interval, 2) : xMin;
      yMin = yMin > 0 ? decimal.subtract(yMin, this.yInterval, 0) : yMin;
      xMax = decimal.add(xMax, this.interval, 2);
      yMax = decimal.add(yMax, this.yInterval, 0);
      this.chartData.xMin = xMin;
      this.chartData.yMin = yMin;
      this.chartData.xMax = xMax;
      this.chartData.yMax = yMax;
      let markLineData = [];
      const chart1 = {
        data: data1,
        connectNulls: true,
        smooth: true,
        symbol: "none",
        type: "line",
        markLine: {
          symbolSize: [1],
          label: { show: false },
          silent: true,
          data: markLineData
        }
      };

      const chart2 = {
        type: "scatter",
        symbolSize: 4,
        data: data2
      };
      this.chartData.seriesData = [chart1, chart2];
    },

    handleFocus(event) {
      handleFocus(event, this.page, this.form[event]);
    },
    handleKeyDown(event, rowIndex, colIndex) {
      const maxArr = [5, 5, 5, 5, 5, 5, 5, 5];
      const ref = handleKeyDown(event, rowIndex, colIndex, maxArr);
      if (this.$refs[ref]?.length) {
        this.$refs[ref][0].focus();
      }
    }
  }
};
</script>

<style scoped lang="scss">
.echarts-border {
  width: 316px;
  height: 166px;
  padding: 2px !important;
  background-color: #ffffff !important;
}
</style>
